package day13_Io.demo02_FileOutPutStream;

import java.io.FileInputStream;


//方法2的读取全部数据
public class Demo07_FileOutPutStream {
    public static void main(String[] args) throws Exception {
        FileInputStream fis = new FileInputStream("E:\\csw\\Demo\\csw1\\csw1.txt");
        byte[] b = new byte[4];
        int i;
        while ((i=fis.read(b))!=-1){
//            for (byte b1 : b) {
//                System.out.print(b1);
//            }
            //String(byte[] bytes, int offset, int length)//byte转化为String
            System.out.println(i);
            String s = new String(b, 0, i);//把byte数组的一部分转化为String
            System.out.println(s);
        }
        fis.close();
    }
}
